package com.lxn.hrm.feignclients;


import com.lxn.course.query.CourseQuery;
import com.lxn.doc.CourseDoc;
import com.lxn.hrm.fallback.ESFeignClientFallbackFactory;
import com.lxn.hrm.util.AjaxResult;
import com.lxn.hrm.util.PageList;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

//value属性：调用目标服务的服务名
@FeignClient(value="es-server", fallbackFactory = ESFeignClientFallbackFactory.class)
public interface ESFeignClient {

    //添加课程
    @PostMapping("/es/save")
    AjaxResult save(@RequestBody CourseDoc courseDoc);

    @DeleteMapping("/es/deleteById/{id}")
    AjaxResult deleteById(@PathVariable("id")Long id);

    @PostMapping("/es/search")
    PageList<CourseDoc> search(@RequestParam("queryJson") String queryJson);

    @PostMapping("/es/searchCourse")
    PageList<CourseDoc> searchCourse(@RequestBody CourseQuery courseQuery);
}
